home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / EGAVGA.SWG / 0087_Font Banks.pas < prev    next >
Pascal/Delphi Source File  |  1994-01-27  |  2KB  |  60 lines

  1. {
  2. >have a vga that I want to use the above mentioned interrupt with. The
  3. >problem is that I can't seem to get the interrupt to do its thing. The
  4. >program seems to go through it with no effect at all. My question is how
  5. >do I get the results?
  6.  
  7. The following procedures may help you. VGA has 8 font banks
  8. (0..7). Load your font using LoadFont, then activate that bank with
  9. SelectFont. Selecting two different font banks will let you display
  10. two fonts simultaneously -- intensity bit selects secondary font (you
  11. loose high intensity colors).
  12. }
  13. procedure SelectFont(Prim, Sec: byte);
  14. var Tmp: byte;
  15. begin
  16.   Tmp := (Prim and $3) or (Prim shl 2 and $10)
  17.   or (Sec shl 2 and $C) or (Sec shl 3 and $20);
  18.   asm
  19.         mov     bl, Tmp
  20.         mov     ax, $1103
  21.         int     $10
  22.   end;
  23.   if (Prim and $7) = (Sec and $7) then
  24.     Tmp := $F
  25.   else
  26.     Tmp := $7;
  27.   asm
  28.         mov     bh, Tmp
  29.         mov     bl, $12
  30.         mov     ax, $1000
  31.         int     $10
  32.   end;
  33. end;
  34.  
  35.  
  36. procedure LoadFont(var Buf; Bank, Height: byte; First, Last: char); assembler;
  37. asm
  38.         mov     dl, First
  39.         xor     dh, dh
  40.         mov     cl, Last
  41.         sub     cl, dl
  42.         mov     ch, dh
  43.         inc     cx
  44.         mov     bl, Bank
  45.         mov     bh, Height
  46.         les     bp, Buf
  47.         mov     ax, $1100
  48.         int     $10
  49. end;
  50.  
  51. var Buf: array [1..4096] of byte;
  52.  
  53. begin
  54.   { Load 256 8x16 characters in buffer }
  55.   LoadFont(Buf, 0, 16, #0, #255);
  56.   SelectFont(0, 0);
  57. end.
  58.  
  59.  
  60.